Class Feindura File source: /library/classes/Feindura.class.php
FeinduraBase | --Feindura
Description
The class for implementing feindura - Flat File Content Management System in a website.
It's methods provide necessary functions for implementing the CMS in a website.
It contains, for example, methods for building a menu and get page contents, etc.
Version
| bool | $xHtml | TRUE when the pages content should be handled as XHTML. |
| int | $page | Contains the current page ID get from the $_GET variable. |
| int | $category | Contains the current category ID get from the $_GET variable. |
| int | $startPage | Contains the startpage ID from the website-settings config. |
| int | $startCategory | Contains the startcategory ID |
| int|false | $linkLength | The number of maximal visible characters in the link text of any link created by createLink() or createMenu(). |
| string|false | $linkId | Contains an id-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu(). |
| string|false | $linkClass | Contains an class-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu(). |
| string|false | $linkAttributes | Contains a string with attributes which will be add to any <a ...> tag of any link created by createLink() or createMenu(). |
| string|false | $linkBefore | Contains a string which will be add before any <a></a> tag of any link created by createLink() or createMenu(). |
| string|false | $linkAfter | Contains a string which will be add after any <a></a> tag of any link created by createLink() or createMenu(). |
| string|false | $linkBeforeText | Contains a string which will be add before the link text but inside any <a></a> tag of any link created by createLink() or createMenu(). |
| string|false | $linkAfterText | Contains a string which will be add after the link text but inside any <a></a> tag of any link created by createLink() or createMenu(). |
| bool | $linkShowThumbnail | If TRUE and the page has a thumbnail it places the thumbnail <img> tag inside the <a></a> tag of any link created by createLink() or createMenu(). |
| bool | $linkShowThumbnailAfterText | If TRUE and thumbnail <img> tag will be placed after the link text but inside the <a></a> tag of any link created by createLink() or createMenu(). |
| bool | $linkShowPageDate | If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the link text of any link created by createLink() or createMenu(). |
| string | $linkPageDateSeparator | If the $linkShowPageDate property is TRUE, this string will be used as a separator between the page date and the link text of any link created by createLink() or createMenu(). |
| bool | $linkShowCategory | If TRUE, the category name of the page will be add before the link text with the $linkCategorySpacer property as separator of any link created by createLink() or createMenu(). |
| string | $linkCategorySeparator | If the $linkShowCategory property is TRUE, this string will be used as a separator between the category name and the link text of any link created by createLink() or createMenu(). |
| string|false | $menuId | Contains an id-Attribute which will be add to the menu tag. |
| string|false | $menuClass | Contains an class-Attribute which will be add to the menu tag. |
| string|false | $menuAttributes | Contains a string with attributes which will be add to the menu tag. |
| int|false | $titleLength | A number of maximal characters visible in the page title. |
| bool | $titleAsLink | If TRUE the page title is also a link to the page. |
| bool | $titleShowPageDate | If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the page title. |
| string | $titlePageDateSeparator | If the $titleShowPageDate property is TRUE, this string will be used as a separator between the page date and the page title. |
| bool | $titleShowCategory | If TRUE, the category name of the page will be add before the page title with the $linkCategorySpacer property as separator. |
| string | $titleCategorySeparator | If the $titleShowCategory property is TRUE, this string will be used as a separator between the category name and the page title. |
| string|false | $thumbnailAlign | Contains the position of the thumbnail picture, the possible values are "left", "right" or FALSE. |
| string|false | $thumbnailId | Contains an id-Attribute which will be add to the thumbnail <img> tag. |
| string|false | $thumbnailClass | Contains an class-Attribute which will be add the thumbnail <img> tag. |
| string|false | $thumbnailAttributes | Contains a string with attributes which will be add the thumbnail <img> tag. |
| string|false | $thumbnailBefore | Contains a string which will be add before the thumbnail <img> tag. |
| string|false | $thumbnailAfter | Contains a string which will be add after the thumbnail <img> tag. |
| bool | $showErrors | If TRUE an error will be displayed if the requested page doesn't exists or is currently not public. |
| string|false | $errorTag | The tag which should be used for the error message. |
| string|false | $errorId | Contains an id-Attribute which will be add to the error tag. |
| string|false | $errorClass | Contains an class-Attribute which will be add to the error tag. |
| string|false | $errorAttributes | Contains a string with attributes which will be add the error tag. |
| void | __construct() | The constructor of the class, sets all basic properties. Run the FeinduraBase::__construct() class constructor to... |
| void | setStartPage() | Set a page ID to the $startPage and $page property. |
| string|false | setLanguage() | Set the FeinduraBase::$language property and reloads the frontend language file. Notice The country code will... |
| string | getLanguage() | Returns the language country code which was set in the feinduraBase:__construct(). |
| array | getLanguageFile() | Check a specific directory for files which have a language code inside the filename (see $filename parameter).... |
| string | createMetaTags() | Creates a string with basic HTML5 meta tags. See the example for a detailed list of the meta tags created. Notice... |
| string|false | createHref() | Generates a href attribute which links to a page. Depending whether speaking URLs is in the administrator-settings... |
| string|false | createLink() | This method uses the $link... and $thumbnail... properties. Creates a link from a page ID. If the given... |
| array | createMenu() | This method uses the $link... , $menu... and $thumbnail... properties. Creates a menu from category or page... |
| array | createMenuByTags() | This method uses the $link... , $menu... and $thumbnail... properties. Create a menu from category or page... |
| array | createMenuByDate() | This method uses the $link... , $menu... and $thumbnail... properties. Creates a menu from category or page... |
| array | createMenuBySortFunction() | Alias createMenuBySort() Alias createMenuBySortCallback() Alias createMenuByCallback() This... |
| string | getPageTitle() | This method uses the $title... properties. Returns the title of a page. This page title will be generated... |
| array | showPage() | This method uses the $error... , $title... and $thumbnail... properties. Returns a page for displaying in a... |
| bool | hasPlugins() | Alias hasPlugin() Alias isPlugins() Alias isPlugin() Check whether the given plugin(s) are activated for... |
| array|string|false | showPlugins() | Returns the plugin(s) of a page ready for displaying in a HTML page. It can return an array where each element... |
| array | listPages() | This method uses the $error... , $title... and $thumbnail... properties. List pages by given category or... |
| array | listPagesByTags() | This method uses the $error... , $title... and $thumbnail... properties. List pages by given category or... |
| array | listPagesByDate() | This method uses the $error... , $title... and $thumbnail... properties. List pages by given category or... |
| array | listPagesBySortFunction() | Alias listPagesBySort() Alias listPagesBySortCallback() Alias listPagesByCallback() This... |
Default value
falseDescription
TRUE when the pages content should be handled as XHTML.
In XHTML standalone tags end with " />" instead of ">".
Therefor when a page content is displayed and this property is FALSE all " />" will be changed to ">".
Default value
nullDescription
Contains the current page ID get from the $_GET variable.
This property is used when a page loading method is called (for example: showPage()) and no page ID parameter is given.
This property will be set in the feindura() constructor through the setCurrentPageId() method.
Used By
- FeinduraBase::setCurrentPageId() - as the property to set
- FeinduraBase::generatePage()
- Feindura::createMetaTags() - to load the page title of teh righte page
- Feindura::showPage()
- Feindura::hasPlugins()
- Feindura::showPlugins()
- Feindura::setStartPage()
Default value
nullDescription
Contains the current category ID get from the $_GET variable.
This property is used when a page-loading method is called (for example: showPage()) and no category ID parameter is given.
This property will be set in the feindura() constructor through the setCurrentCategoryId() method.
Used By
- FeinduraBase::setCurrentCategoryId() - as the property to set
- Feindura::createMetaTags() - to load the page title of teh righte page
Default value
nullDescription
Contains the startpage ID from the website-settings config.
This property is set to the $page property when the $_GET page variable and the $page property is empty and setting a startpage is activated in the page-settings.
This property will be set in the feindura() constructor through the setCurrentPageId() method.
Used By
- FeinduraBase::getCurrentPageId() - if no $_GET variable exists it will try to get the Feindura::$startPage property
- FeinduraBase::setCurrentPageId() - if the $setStartPage parameter is TRUE this property will also be set
- Feindura::setStartPage()
Default value
nullDescription
Contains the startcategory ID
Its fetched from the $startPage through the GeneralFunctions::getPageCategory() method.
This property is set to the $category property when the $_GET category variable and the $category property is empty and setting a startpage is activated in the page-settings.
This property will be set in the feindura() constructor through the setCurrentCategoryId() method.
Used By
- FeinduraBase::getCurrentCategoryId() - if no $_GET variable exists it will try to get the Feindura::$startCategory property
- FeinduraBase::setCurrentCategoryId() - if the $setStartCategory parameter is TRUE this property will also be set
Default value
falseDescription
The number of maximal visible characters in the link text of any link created by createLink() or createMenu().
The link text will be shorten to the last complete word.
For example the following string will be shorten to a $linkLength of "30": "Example Category -> Example Page Title" => "Example Category -> Example..."
Default value
falseDescription
Contains an id-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu().
Notice: You can only set one specific id-Attribute to elements in a HTML page, if you set this property and call createMenu() every link in the menu will get this id-Attribute.
Default value
falseDescription
Contains an class-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will get this class-Attribute.
Default value
falseDescription
Contains a string with attributes which will be add to any <a ...> tag of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will get this attributes string.
The string should have the following format 'key1="value" key2="value"'
Default value
falseDescription
Contains a string which will be add before any <a></a> tag of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will get this string.
Default value
falseDescription
Contains a string which will be add after any <a></a> tag of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will get this string.
Default value
falseDescription
Contains a string which will be add before the link text but inside any <a></a> tag of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will get this string.
Default value
falseDescription
Contains a string which will be add after the link text but inside any <a></a> tag of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will get this string.
Default value
falseDescription
If TRUE and the page has a thumbnail it places the thumbnail <img> tag inside the <a></a> tag of any link created by createLink() or createMenu().
Default value
falseDescription
If TRUE and thumbnail <img> tag will be placed after the link text but inside the <a></a> tag of any link created by createLink() or createMenu().
Default value
falseDescription
If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the link text of any link created by createLink() or createMenu().
If the $linkShowCategory property is TRUE, the page date is placed between the category name + separator and the link text.
The page date will be added with the page before-date-text and after-date-text from the page editor in the backend
Notice: The page date will only be displayed if the $linkText parameter of createLink() or createMenu() methods is TRUE and not a string.
Example: <a href="?page=2" ...>Catgory Name: 200-12-31 Page Title</a>
Default value
' 'Description
If the $linkShowPageDate property is TRUE, this string will be used as a separator between the page date and the link text of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will use this separator.
Default value
falseDescription
If TRUE, the category name of the page will be add before the link text with the $linkCategorySpacer property as separator of any link created by createLink() or createMenu().
The category name will only be displayed if the $linkText parameter of createLink() or createMenu() methods is TRUE and not a string.
Example: <a href="?page=2" ...>Catgory Name: Page Title</a>
Default value
': 'Description
If the $linkShowCategory property is TRUE, this string will be used as a separator between the category name and the link text of any link created by createLink() or createMenu().
Notice: If you set this property and call createMenu() every link in the menu will use this separator.
Default value
falseDescription
Contains an id-Attribute which will be add to the menu tag.
Notice 1: This id-Attribute will only be add, if the $menuTag parameter in the createMenu() method is not FALSE.
Notice 2: You can only set one specific id-Attribute to elements in a HTML page.
Default value
falseDescription
Contains an class-Attribute which will be add to the menu tag.
Notice: This class-Attribute will only be add, if the $menuTag parameter in the createMenu() method is not FALSE.
Default value
falseDescription
Contains a string with attributes which will be add to the menu tag.
Notice: This string with attributes will only be add, if the $menuTag parameter in the createMenu() method is not FALSE.
The string should have the following format 'key1="value" key2="value"'
Default value
falseDescription
A number of maximal characters visible in the page title.
The page title will be shorten to the last complete word.
For example the following string will be shorten to a $titleLength of "30": "Example Category -> Example Page Title" => "Example Category -> Example..."
Default value
falseDescription
If TRUE the page title is also a link to the page.
Default value
falseDescription
If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the page title.
If the $titleShowCategory property is TRUE, the page date is placed between the category name + separator and the page title.
The page date will be added with the page before-date-text and after-date-text from the page editor in the backend.
Example: Catgory Name: 200-12-31 Page Title
Default value
' 'Description
If the $titleShowPageDate property is TRUE, this string will be used as a separator between the page date and the page title.
Default value
falseDescription
If TRUE, the category name of the page will be add before the page title with the $linkCategorySpacer property as separator.
Example: Catgory Name: Page Title
Default value
': 'Description
If the $titleShowCategory property is TRUE, this string will be used as a separator between the category name and the page title.
Default value
falseDescription
Contains the position of the thumbnail picture, the possible values are "left", "right" or FALSE.
If the values are "left" or "right" a style-attribute will be add to the thumbnail <img> tag with "float:left/right;".
Notice: If you set this property, you can't add any style attribute with the $thumbnailAttributes property anymore, it would not be used by the browser.
<img src="/path/image.png" ... style="float:left;" />
Used By
- FeinduraBase::generatePage()
- Feindura::createLink()
- Feindura::createMenu()
- Feindura::createMenuByTags()
- Feindura::createMenuByDate()
- Feindura::createMenuBySortFunction()
- Feindura::showPage()
- Feindura::listPages()
- Feindura::listPagesByTags()
- Feindura::listPagesByDate()
- Feindura::listPagesBySortFunction()
Default value
falseDescription
Contains an id-Attribute which will be add to the thumbnail <img> tag.
Notice: You can only set one specific id-Attribute to elements in a HTML page.
Used By
- FeinduraBase::generatePage()
- Feindura::createLink()
- Feindura::createMenu()
- Feindura::createMenuByTags()
- Feindura::createMenuByDate()
- Feindura::createMenuBySortFunction()
- Feindura::showPage()
- Feindura::listPages()
- Feindura::listPagesByTags()
- Feindura::listPagesByDate()
- Feindura::listPagesBySortFunction()
Default value
falseDescription
Contains an class-Attribute which will be add the thumbnail <img> tag.
Used By
- FeinduraBase::generatePage()
- Feindura::createLink()
- Feindura::createMenu()
- Feindura::createMenuByTags()
- Feindura::createMenuByDate()
- Feindura::createMenuBySortFunction()
- Feindura::showPage()
- Feindura::listPages()
- Feindura::listPagesByTags()
- Feindura::listPagesByDate()
- Feindura::listPagesBySortFunction()
Default value
falseDescription
Contains a string with attributes which will be add the thumbnail <img> tag.
The string should have the following format 'key1="value" key2="value"'
Used By
- FeinduraBase::generatePage()
- Feindura::createLink()
- Feindura::createMenu()
- Feindura::createMenuByTags()
- Feindura::createMenuByDate()
- Feindura::createMenuBySortFunction()
- Feindura::showPage()
- Feindura::listPages()
- Feindura::listPagesByTags()
- Feindura::listPagesByDate()
- Feindura::listPagesBySortFunction()
Default value
falseDescription
Contains a string which will be add before the thumbnail <img> tag.
Used By
- FeinduraBase::generatePage()
- Feindura::createLink()
- Feindura::createMenu()
- Feindura::createMenuByTags()
- Feindura::createMenuByDate()
- Feindura::createMenuBySortFunction()
- Feindura::showPage()
- Feindura::listPages()
- Feindura::listPagesByTags()
- Feindura::listPagesByDate()
- Feindura::listPagesBySortFunction()
Default value
falseDescription
Contains a string which will be add after the thumbnail <img> tag.
Used By
- FeinduraBase::generatePage()
- Feindura::createLink()
- Feindura::createMenu()
- Feindura::createMenuByTags()
- Feindura::createMenuByDate()
- Feindura::createMenuBySortFunction()
- Feindura::showPage()
- Feindura::listPages()
- Feindura::listPagesByTags()
- Feindura::listPagesByDate()
- Feindura::listPagesBySortFunction()
Default value
trueDescription
If TRUE an error will be displayed if the requested page doesn't exists or is currently not public.
Example: <span>The requested page is currently not available.</span>
Default value
'span'Description
The tag which should be used for the error message.
Notice: If this property is no string, the $errorId, $errorClass and $errorAttributes property will not be add.
Example: <span>The requested page is currently not available.</span>
Default value
falseDescription
Contains an id-Attribute which will be add to the error tag.
Notice 1: This id-Attribute will only be add, if the $errorTag property is a string and not FALSE.
Notice 2: You can only set one specific id-Attribute to elements in a HTML page.
Example: <span id="exampleId">The requested page is currently not available.</span>
Default value
falseDescription
Contains an class-Attribute which will be add to the error tag.
Notice: This class-Attribute will only be add, if the $errorTag property is a string and not FALSE.
Example: <span class="exampleId">The requested page is currently not available.</span>
Default value
falseDescription
Contains a string with attributes which will be add the error tag.
The string should have the following format 'key1="value" key2="value"'
Example: <span key1="value" key2="value">The requested page is currently not available.</span>
Parameters
| string | $language |
(optional) A country code like "de", "en", ... to load the right frontend language-file and is also set to the FeinduraBase::$language property Default false |
- FeinduraBase::__construct()
- Type constructor
Description
Type constructor
The constructor of the class, sets all basic properties.
Run the FeinduraBase::__construct() class constructor to set all necessary properties Fetch the $_GET variable (if existing) and set it to the $page and $category properties.
If there is no page and category ID it sets the start page ID from the website-settings config.
Example:
<?php // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance ?>
Uses
- FeinduraBase::__construct() - the constructor of the parent class to load all necessary properties
- FeinduraBase::setCurrentCategoryId() - to set the fetched category ID from the $_GET variable to the $category property
- FeinduraBase::setCurrentPageId() - to set the fetched page ID from the $_GET variable to the $page property
Version
Parameters
| int | $pageId |
the page ID to set |
Uses
- Feindura::$startPage
- Feindura::$page
- GeneralFunctions::getPageCategory() - to get the category of the page
Version
Parameters
| string | $language |
a language country code like "en", "de", ... |
Description
Name setLanguage()
Set the FeinduraBase::$language property and reloads the frontend language file.
Notice The country code will NOT set to any $_SESSION variable, you have to take care of this yourself.
Uses
- FeinduraBase::$language - the language country code like "en", "de", ... which will be returned
Return Value
Version
Description
Name getLanguage()
Returns the language country code which was set in the feinduraBase:__construct().
Uses
- FeinduraBase::$language - the language country code like "en", "de", ... which will be returned
Return Value
Version
line 914
| array getLanguageFile ( |
[string|false $langPath = false], [string $filename = '%lang%.php'], [string@false &$currentLangCode = false], [bool $standardLang = 'en']) |
Parameters
| string|false | $langPath |
(optional) a absolut path to look for a language file which fit the $filename parameter or FALSE to use the "feindura-cms/library/languages" folder Default false |
| string | $filename |
(optional) the structure of the filename, which should be loaded. the "%lang%" will be replaced with the country code like "%lang%.backend.php" -> "en.backend.php" Default '%lang%.php' |
| string@false | &$currentLangCode |
(optional) (Note: this variable will also be changed outside of this method) a variable with the current language code, if this is set it will be first try to load this language file, when it couldn't find a language file which fits the browsers language code. Default false |
| bool | $standardLang |
(optional) a standard language for use if no match was found Default 'en' |
Description
Name getLanguageFile()
Check a specific directory for files which have a language code inside the filename (see $filename parameter). When a matching file is found it includes these and return it. If no match could be found it try to find a file with the browser language code, if this didnt work either it uses the $standardLang parameter.
Example of a language file
<?php $langFile['SEARCH_TITLE'] = 'Search'; $langFile['TITLE_NEWS'] = 'What\'s new'; ... return $langFile; ?>
Used Constants
- DOCUMENTROOT the absolut path of the webserver
Uses
- GeneralFunctions::loadLanguageFile() - to load the right language file
Return Value
Version
line 965
| string createMetaTags ( |
[string $charset = 'UTF-8'], [string|false $author = false], [string|bool $publisher = true], [string|bool $copyright = true]) |
Parameters
| string | $charset |
(optional) the charset used in the website like "UTF-8", "iso-8859-1", ... Default 'UTF-8' |
| string|false | $author |
(optional) the author of the website Default false |
| string|bool | $publisher |
(optional) the publisher of the website, if TRUE it uses the publisher from the website-settings config Default true |
| string|bool | $copyright |
(optional) the copyright owner of the website, if TRUE it uses the copyright from the website-settings config Default true |
Description
Name createMetaTags()
Alias createMetaTag()
Creates a string with basic HTML5 meta tags. See the example for a detailed list of the meta tags created.
Notice: You have to call this method in the <head> tags of your website, to enable the frontend editing feature. Notice: This method also adds the Feed tags.
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // start to write HTML page echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head>'; // writes the meta tags in the <head> echo '</head> <body> ...'; /* *** RESULT *** -------------------------------------------------------------------------------- */ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8" /> <meta http-equiv="content-language" content="en" /> <title> Welcome - feinduraExample.com </title> <meta name="siteinfo" content="robots.txt" /> <meta name="revisit_after" content="12" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- enable google chrome frame, if available --> <meta name="viewport" content="width=device-width, initial-scale=0.5" /> <!-- set width for mobile devices --> <meta name="title" content="feinduraExample.com - Welcome" /> <meta name="author" content="Fabian Vogelsteller" /> <meta name="publisher" content="Puslisher written in the Backend" /> <meta name="copyright" content="Copyright written in the Backend" /> <meta name="description" content="This example website is intended to show how easy it is to use feindura CMS." /> <meta name="keywords" content="keyword1,keyword2,keyword3,keyword4" /> <link rel="alternate" type="application/atom+xml" title="News - feinduraExample.com (Atom)" href="http://feinduraexample.com/cms/pages/1/atom.xml" /> <link rel="alternate" type="application/rss+xml" title="News - feinduraExample.com (RSS 2.0)" href="http://feinduraexample.com/cms/pages/1/rss2.xml" /> </head> <body> ... ?>
Uses
- Feindura::$page - to load the page title of teh righte page
- Feindura::$category - to load the page title of teh righte page
- FeinduraBase::$websiteConfig - for the website title, publisher, copyright, description and keywords
- GeneralFunctions::readPage() - to load the page for the page title
Return Value
Version
Parameters
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array) Default false |
Description
Name createHref()
Generates a href attribute which links to a page. Depending whether speaking URLs is in the administrator-settings activated, it generates a different href attribute.
If cookies are deactivated it attaches the $sessionId on the end.
Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:
<?php // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property. // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page. // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one. empty // load the current page false/true // same as above array(false,false) // same as above 2 // load page with ID 2 'rand' // load a random page of the current category array('rand',false) // same as above 'next' // load the next page in the current category array('next',false) // the same as above array('next','rand') // the same as above (it would discard the category ID) array(2,45) // load the page with ID 2 (it would discard the category ID) array(false,3) // load the first page of category with ID 3 array(false,'next') // load the first page of the next category array(false,'prev') // load the first page of the previous category array('last',false) // load the last page of the current category array('last','next') // load the last page of the next category array('first','last') // load the first page of the last category array('rand','next') // load a random page of the next category array('rand','rand') // load a random page of a random category array('first','rand') // load the first page of a random category ?>
Examples of the returned href string: ("user=xyz123" stands for: sessionname=sessionid)
Pages without category: '?page=1&user=xyz123' Pages with category: '?category=1&page=1&user=xyz123'
Speaking URL href for pages without category: '/page/page_title.html?user=xyz123' Speaking URL href for pages with category: '/category/category_name/page_title.html?user=xyz123'
Used By
- Feindura::createLink() - to create the href-attribute
Uses
- FeinduraBase::getPropertyIdsByString() - to load the right page and category IDs depending on the $ids parameter
- GeneralFunctions::createHref() - call the right createHref functions in the GeneralFunctions class
- GeneralFunctions::getPageCategory() - to get the category of the page
Return Value
Version
line 1264
| string|false createLink ( |
[int|string|array|bool $ids = false], [string|bool $linkText = true]) |
Parameters
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array) Default false |
| string|bool | $linkText |
(optional) a string with a linktext which the link will use, if TRUE it uses the page title of the page, if FALSE no linktext will be used Default true |
Description
Name createLink()
This method uses the $link... and $thumbnail... properties.
Creates a link from a page ID.
If the given $page parameter is a string with "previous" or "next", it creates a link from the previous or the next page starting from the current page ID stored in the $page property. If there is no current, next or previous page in it returns FALSE.
Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. <b>Notice</b>: It add the class name <i>"active"</i> to the link, when the current $page property matches the page ID of the link. Example <var$ids parameters:
<?php // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property. // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page. // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one. empty // load the current page false/true // same as above array(false,false) // same as above 2 // load page with ID 2 'rand' // load a random page of the current category array('rand',false) // same as above 'next' // load the next page in the current category array('next',false) // the same as above array('next','rand') // the same as above (it would discard the category ID) array(2,45) // load the page with ID 2 (it would discard the category ID) array(false,3) // load the first page of category with ID 3 array(false,'next') // load the first page of the next category array(false,'prev') // load the first page of the previous category array('last',false) // load the last page of the current category array('last','next') // load the last page of the next category array('first','last') // load the first page of the last category array('rand','next') // load a random page of the next category array('rand','rand') // load a random page of a random category array('first','rand') // load the first page of a random category ?>
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call createLink(1) without setting properties and you have a simple link with the page title. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // set link properties // set thumbnail properties // finally create the link from the page with ID "1" using the above set link properties // displays the link echo $link; /* *** RESULT *** -------------------------------------------------------------------------------- */ id="exampleId" class="exampleClass" test="exampleAttribute1" onclick="exampleAttribute2"> text before thumbnail <img src="/path/thumb_page1.png" alt="Thumbnail" title="Example Page" id="thumbId" class="thumbClass" test="thumbnailAttr1" onclick="thumbnailAttr2" style="float:left;" /> text after thumbnail text before Example Category: 2010-12-31 Example.. text after </a> text after link ?>
Used By
- Feindura::createMenu() - to create a link from every $pageContent array
Uses
- Feindura::$linkLength
- Feindura::$linkId
- Feindura::$linkClass
- Feindura::$linkAttributes
- Feindura::$linkBefore
- Feindura::$linkAfter
- Feindura::$linkBeforeText
- Feindura::$linkAfterText
- Feindura::$linkShowThumbnail
- Feindura::$linkShowThumbnailAfterText
- Feindura::$linkShowPageDate
- Feindura::$linkShowCategory
- Feindura::$linkCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- Feindura::createHref() - to create the href-attribute
- FeinduraBase::getPropertyIdsByString() - to load the right page and category IDs depending on the $ids parameter
- FeinduraBase::createAttributes() - to create the attributes used by the link <a> tag
- FeinduraBase::createThumbnail() - to create the thumbnail for the link if the $linkShowThumbnail property is TRUE
- FeinduraBase::shortenText() - to shorten the linktext if the $linkLength property is set
- GeneralFunctions::getPageCategory() - to get the category of the page
- GeneralFunctions::isPublicCategory() - to check whether the category is public
Return Value
Version
line 1424
| array createMenu ( |
[string $idType = 'category'], [int|array|bool $ids = false], [int|bool $menuTag = false], [string|bool $linkText = true], [int|false $breakAfter = false], [bool $sortByCategories = false]) |
Parameters
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|bool | $menuTag |
(optional) the tag which is used to create the menu, can be an "menu", "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag Default false |
| string|bool | $linkText |
(optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used Default true |
| int|false | $breakAfter |
(optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect Default false |
| bool | $sortByCategories |
(optional) if TRUE it sorts the given category or page ID(s) by category Default false |
Description
Name createMenu()
This method uses the $link..., $menu... and $thumbnail... properties.
Creates a menu from category or page ID(s).
The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary child HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.
In case no page with the given category or page ID(s) exist it returns an empty array.
Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.
Notice: the link which fits the current ID in the $page property will get the class name "active".
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call createMenu('category',1) and you have a simple array with links of the pages from this category. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // set menu properties // set link properties // set thumbnail properties // finally create the menu from the category with ID "1" using the above set properties // displays the menu foreach($menu as $link) { echo $link; } /* *** RESULT *** -------------------------------------------------------------------------------- */ <table id="menuId" class="menuClass" test="menuAttribute1" onclick="menuAttribute2"> <tr><td> text before link <a href="?category=1&page=1" title="Example Category: 2010-12-31 Example Page 1" class="linkClass" test="linkAttribute1" onclick="linkAttribute2"> text before thumbnail <img src="/path/thumb_page1.png" alt="Thumbnail" title="Example Page 1" class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" /> text after thumbnail text before Example Category: 2010-12-31 Example... text after </a> text after link </td><td> text before link <a href="?category=1&page=2" title="Example Category: 2010-11-25 Example Page 2" class="linkClass" test="linkAttribute1" onclick="linkAttribute2"> text before thumbnail <img src="/path/thumb_page2.png" alt="Thumbnail" title="Example Page 2" class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" /> text after thumbnail text before Example Category: 2010-11-25 Example... text after </a> text after link </td> </tr><tr> <td> text before link <a href="?category=1&page=3" title="Example Category: 2010-10-15 Example Page 3" class="linkClass" test="linkAttribute1" onclick="linkAttribute2"> text before thumbnail <img src="/path/thumb_page3.png" alt="Thumbnail" title="Example Page 3" class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" /> text after thumbnail text before Example Category: 2010-10-15 Example... text after </a> text after link </td><td> text before link <a href="?category=1&page=4" title="Example Category: 2010-09-05 Example Page 4" class="linkClass" test="linkAttribute1" onclick="linkAttribute2"> text before thumbnail <img src="/path/thumb_page4.png" alt="Thumbnail" title="Example Page 4" class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" /> text after thumbnail text before Example Category: 2010-09-05 Example... text after </a> text after link </td></tr> </table> ?>
Used By
- Feindura::createMenuByTags() - to create the menu from the pages load by FeinduraBase::hasTags()
- Feindura::createMenuByDate() - to create the menu from the pages load by FeinduraBase::hasTags()
- Feindura::createMenuBySortFunction() - to create the menu from the pages load by FeinduraBase::hasTags()
Uses
- Feindura::$menuId
- Feindura::$menuClass
- Feindura::$menuAttributes
- Feindura::$linkLength
- Feindura::$linkId
- Feindura::$linkClass
- Feindura::$linkAttributes
- Feindura::$linkBefore
- Feindura::$linkAfter
- Feindura::$linkBeforeText
- Feindura::$linkAfterText
- Feindura::$linkShowThumbnail
- Feindura::$linkShowThumbnailAfterText
- Feindura::$linkShowPageDate
- Feindura::$linkShowCategory
- Feindura::$linkCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- Feindura::createLink() - to create a link from every $pageContent array
- FeinduraBase::getPropertyIdsByType() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- FeinduraBase::loadPagesByType() - to load the page $pageContent array(s) from the given ID(s)
- FeinduraBase::createAttributes() - to create the attributes used in the menu tag
- GeneralFunctions::sortPages() - to sort the $pageContent arrays by category
Return Value
Version
line 1651
| array createMenuByTags ( |
string|array $tags, [string $idType = 'category'], [int|array|bool $ids = false], [int|bool $menuTag = false], [string|bool $linkText = true], [int|false $breakAfter = false], [bool $sortByCategories = false]) |
Parameters
| string|array | $tags |
a string with tags seperated by "," or whitespaces, or an array with tags |
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|bool | $menuTag |
(optional) the tag which is used to create the menu, can be an "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag Default false |
| string|bool | $linkText |
(optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used Default true |
| int|false | $breakAfter |
(optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect Default false |
| bool | $sortByCategories |
(optional) if TRUE it sorts the given category or page ID(s) by category Default false |
Description
Name createMenuByTags()
Alias createMenuByTag()
This method uses the $link..., $menu... and $thumbnail... properties.
Create a menu from category or page ID(s) with pages which have one or more of the tags from the given $tags parameter.
Notice: the tags will be compared case insensitive.
The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.
In case no page with the given category or page ID(s) or tags exist it returns an empty array.
Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter. Notice: the link which fits the current ID in the $page property will get the class name "active".
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example shows only the usage of tags for creating a menu, for a detailed menu example see createMenu() */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // the tags where the pages in the menu should have atleast one $tags = 'winter summer spring'; // could also be an array like // $tags = array(0 => 'winter', 1 => 'summer', 2 => 'spring'); // finally create the menu from the category with ID "1" using the above set tags // displays the menu foreach($menu as $link) { echo $link; } /* *** RESULT *** -------------------------------------------------------------------------------- */ <table> <tr><td> <a href="?category=1&page=1" title="Summer Page"> Summer Page </a> </td><td> <a href="?category=1&page=2" title="Winter Page"> Winter Page </a> </td> </tr><tr> <td> <a href="?category=1&page=6" title="Spring Page"> Spring Page </a> </td><td></td> </tr> </table> ?>
Uses
- Feindura::$menuId
- Feindura::$menuClass
- Feindura::$menuAttributes
- Feindura::$linkLength
- Feindura::$linkId
- Feindura::$linkClass
- Feindura::$linkAttributes
- Feindura::$linkBefore
- Feindura::$linkAfter
- Feindura::$linkBeforeText
- Feindura::$linkAfterText
- Feindura::$linkShowThumbnail
- Feindura::$linkShowThumbnailAfterText
- Feindura::$linkShowPageDate
- Feindura::$linkShowCategory
- Feindura::$linkCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::getPropertyIdsByType() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- FeinduraBase::hasTags() - to get only the pages which have one or more tags from the given $tags parameter
- Feindura::createMenu() - to create the menu from the pages load by FeinduraBase::hasTags()
Return Value
Version
line 1744
| array createMenuByDate ( |
[string $idType = 'category'], [int|array|bool $ids = false], [int|bool|string $monthsInThePast = true], [int|bool|string $monthsInTheFuture = true], [int|bool $menuTag = false], [string|bool $linkText = true], [int|false $breakAfter = false], [bool $sortByCategories = false], [bool $reverseList = false]) |
Parameters
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|bool|string | $monthsInThePast |
(optional) number of months before today, if TRUE it show all pages in the past, if FALSE it loads only pages starting from today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php Default true |
| int|bool|string | $monthsInTheFuture |
(optional) number of months after today, if TRUE it show all pages in the future, if FALSE it loads only pages until today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php Default true |
| int|bool | $menuTag |
(optional) the tag which is used to create the menu, can be an "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag Default false |
| string|bool | $linkText |
(optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used Default true |
| int|false | $breakAfter |
(optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect Default false |
| bool | $sortByCategories |
(optional) if TRUE it sorts the given category or page ID(s) by category Default false |
| bool | $reverseList |
(optional) reverse the menu listing Default false |
Description
Name createMenuByDate()
Alias createMenuByDates()
This method uses the $link..., $menu... and $thumbnail... properties.
Creates a menu from category or page ID(s) sorted by the page date, with pages which have a page date and the page date fit in the time period from the $monthsInThePast and the $monthsInTheFuture parameter starting from the date today.
The $monthsInThePast and $monthsInTheFuture parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.
The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.
In case no page with the given category or page ID(s) or tags exist it returns an empty array.
Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter. Notice: the link which fits the current ID in the $page property will get the class name "active".
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example shows only the usage of a time period for creating a menu, for a detailed menu example see createMenu() */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // set this property to show the page date in the menu linktext // the "text before date" and "text after date:" was set in the page editor in the backend // create the menu from the category with ID "1" using the time period: // load all pages in the past until 8 months in the future starting from the date today: 31.05.2010 // displays the menu foreach($menu as $link) { echo $link; } /* *** RESULT *** -------------------------------------------------------------------------------- */ <table> <tr><td> <a href="?category=1&page=1" title="text before date 2005-10-31 text after date: Oldest Page"> </a> </td><td> <a href="?category=1&page=2" title="text before date 2010-11-31 text after date: Newer Page"> </a> </td> </tr><tr> <td> <a href="?category=1&page=3" title="text before date 2010-12-31 text after date: Newest Page"> </a> </td><td></td> </tr> </table> ?>
Uses
- Feindura::$menuId
- Feindura::$menuClass
- Feindura::$menuAttributes
- Feindura::$linkLength
- Feindura::$linkId
- Feindura::$linkClass
- Feindura::$linkAttributes
- Feindura::$linkBefore
- Feindura::$linkAfter
- Feindura::$linkBeforeText
- Feindura::$linkAfterText
- Feindura::$linkShowThumbnail
- Feindura::$linkShowThumbnailAfterText
- Feindura::$linkShowPageDate
- Feindura::$linkShowCategory
- Feindura::$linkCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::loadPagesByDate() - to load the pages which fit in the given time period parameters, sorted by the page date
- Feindura::createMenu() - to create the menu from the pages load by FeinduraBase::hasTags()
Return Value
Version
line 1834
| array createMenuBySortFunction ( |
string $sortCallback, [string $idType = 'category'], [int|array|bool $ids = false], [int|bool $menuTag = false], [string|bool $linkText = true], [int|false $breakAfter = false], [bool $reverseList = false]) |
Parameters
| string | $sortCallback |
the name of the callback function to sort the menu (the callback function is a function which can be passed to usort()) |
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|bool | $menuTag |
(optional) the tag which is used to create the menu, can be an "menu", "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag Default false |
| string|bool | $linkText |
(optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used Default true |
| int|false | $breakAfter |
(optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect Default false |
| bool | $reverseList |
(optional) reverse the menu listing Default false |
Description
Name createMenuBySortFunction()
Alias createMenuBySort()
Alias createMenuBySortCallback()
Alias createMenuByCallback()
This method uses the $link..., $menu... and $thumbnail... properties.
Creates a menu from category or page ID(s) sorted by a custom sort function, passed in the first parameter $sortCallback.
The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.
In case no page with the given category or page ID(s) or tags exist it returns an empty array.
Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter. Notice: the link which fits the current ID in the $page property will get the class name "active".
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call createMenu('category',1) and you have a simple array with links of the pages from this category. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // create the sort function, which we use with the createMenuBySortFunction() method function sortByLastEditDate($a,$b) { if ($a['lastSaveDate'] == $b['lastSaveDate']) return 0; return ($a['lastSaveDate'] > $b['lastSaveDate']) ? -1 : 1; } // now we create the menu from the category with ID "1" // displays the menu foreach($menu as $link) { echo $link; } /* *** RESULT *** -------------------------------------------------------------------------------- */ <table> <tr><td> <a href="?category=1&page=2" title="Example Page 2"> Example Page 2 </a> </td> <td> <a href="?category=1&page=1" title="Example Page 1"> Example Page 1 </a> </td> </tr><tr> <td> <a href="?category=1&page=4" title="Example Page 4"> Example Page 4 </a> </td> <td> <a href="?category=1&page=3" title="Example Page 3"> Example Page 3 </a> </td></tr> </table> ?>
Uses
- Feindura::$menuId
- Feindura::$menuClass
- Feindura::$menuAttributes
- Feindura::$linkLength
- Feindura::$linkId
- Feindura::$linkClass
- Feindura::$linkAttributes
- Feindura::$linkBefore
- Feindura::$linkAfter
- Feindura::$linkBeforeText
- Feindura::$linkAfterText
- Feindura::$linkShowThumbnail
- Feindura::$linkShowThumbnailAfterText
- Feindura::$linkShowPageDate
- Feindura::$linkShowCategory
- Feindura::$linkCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::loadPagesByType() - to load the pages which fit in the given time period parameters, sorted by the page date
- Feindura::createMenu() - to create the menu from the pages load by FeinduraBase::hasTags()
Return Value
Version
Parameters
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array) Default false |
Description
Name getPageTitle()
Alias getTitle()
This method uses the $title... properties.
Returns the title of a page. This page title will be generated using the title properties.
Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:
<?php // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property. // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page. // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one. empty // load the current page false/true // same as above array(false,false) // same as above 2 // load page with ID 2 'rand' // load a random page of the current category array('rand',false) // same as above 'next' // load the next page in the current category array('next',false) // the same as above array('next','rand') // the same as above (it would discard the category ID) array(2,45) // load the page with ID 2 (it would discard the category ID) array(false,3) // load the first page of category with ID 3 array(false,'next') // load the first page of the next category array(false,'prev') // load the first page of the previous category array('last',false) // load the last page of the current category array('last','next') // load the last page of the next category array('first','last') // load the first page of the last category array('rand','next') // load a random page of the next category array('rand','rand') // load a random page of a random category array('first','rand') // load the first page of a random category ?>
Example:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call createLink(1) without setting properties and you have a simple link with the page title. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // set title properties // finally create the title from the page with ID "1" using the above set title properties // displays the link echo $title; /* *** RESULT *** -------------------------------------------------------------------------------- */ <a href="?category=1&page=3" title="Example Category 1 -> 31.12.2010 Example Page"> Example Category -> 31.12.2010 Example... </a> ?>
Uses
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- FeinduraBase::getPropertyIdsByString() - to load the right page and category IDs depending on the $ids parameter
- FeinduraBase::createTitle() - to generate the page title with the right title properties
- GeneralFunctions::getPageCategory() - to get the category of the page
- GeneralFunctions::isPublicCategory() - to check whether the category is public
Return Value
Version
line 2017
| array showPage ( |
[int|string|array|bool $ids = false], [int|array|bool $shortenText = false], [bool|string $useHtml = true]) |
Parameters
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array) Default false |
| int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') Default false |
| bool|string | $useHtml |
(optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags. Default true |
Description
Name showPage()
Alias showPages()
This method uses the $error..., $title... and $thumbnail... properties.
Returns a page for displaying in a HTML-page. This array will conatin all elements of the page, ready for displaying in a HTML-page.
In case the page doesn't exists or is not public and the $showErrors property is TRUE, an error will be placed in the ['content'] part of the returned array, otherwiese it returns an empty array.
Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:
<?php // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property. // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page. // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one. empty // load the current page false/true // same as above array(false,false) // same as above 2 // load page with ID 2 'rand' // load a random page of the current category array('rand',false) // same as above 'next' // load the next page in the current category array('next',false) // the same as above array('next','rand') // the same as above (it would discard the category ID) array(2,45) // load the page with ID 2 (it would discard the category ID) array(false,3) // load the first page of category with ID 3 array(false,'next') // load the first page of the next category array(false,'prev') // load the first page of the previous category array('last',false) // load the last page of the current category array('last','next') // load the last page of the next category array('first','last') // load the first page of the last category array('rand','next') // load a random page of the next category array('rand','rand') // load a random page of a random category array('first','rand') // load the first page of a random category ?>
Example of the returned array:
<?php array( 'id' => 1, 'category' => 'Example Category', 'pageDate' => '2000-12-31', // format depending on the administrator-settings 'pageDateTimestamp' => 1325393999, 'title' => 'Title Example', 'thumbnail' => '<img src="/path/thumb_page1.png" alt="Thumbnail" title="Title Example" />', 'thumbnailPath' => '/path/thumb_page1.png', 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag1 tag2 tag3', 'plugins' => array( 'imageGallery' => array( 'active' = true, 'galleryPath' = '/upload/gallery/', 'imageWidth' = 800, 'imageHeight' = null, 'thumbnailWidth' = 160, 'thumbnailHeight' = null, 'tag' = 'table', 'breakAfter' = 3 ), 'pageRating' => array( 'active' = false, 'value' = 0, 'votes' = 0 ) ) ) ?>
Example usage:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call showPage() without setting properties and it shows the current page given by the $_GET variable. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // set properties // finally, return the page, with ID "1", using the above set properties // displays the page (the "\n" creates a line break for a better look) echo $page['title']."\n"; echo $page['thumbnail']."\n"; echo $page['content']; /* *** RESULT with page *** -------------------------------------------------------------------------------- */ <a href="?page=1" title="2010-12-31 Example Page"> 2010-12-31 Example... </a> <img src="/path/thumb_page3.png" alt="Thumbnail" title="Example Page 1" id="thumbId" class="thumbCLass" test="exampleAttribute1" onclick="exampleAttribute2" style="float:left;" /> <h2>Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.</p> <p>Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam...</p> <a href="?page=1">mehr</a> /* *** RESULT with error *** -------------------------------------------------------------------------------- */ <span id="errorId" class="errorClass" test="exampleAttribute1" onclick="exampleAttribute2"> The requested page is currently not available. </span> ?>
Uses
- Feindura::$page
- Feindura::$xHtml
- Feindura::$showErrors
- Feindura::$errorTag
- Feindura::$errorId
- Feindura::$errorClass
- Feindura::$errorAttributes
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::getPropertyIdsByString() - to load the right page and category IDs depending on the $ids parameter
- FeinduraBase::generatePage() - to generate the array with the page elements
- StatisticFunctions::countAndSavePageStatistics() - to save the statistic of the page
- GeneralFunctions::getPageCategory() - to get the category of the page
Return Value
Version
line 2097
| bool hasPlugins ( |
[string|array|true $plugins = true], [int|string|array|bool $ids = false]) |
Parameters
| string|array|true | $plugins |
(optional) the plugin name or an array with plugin names or TRUE to load all plugins Default true |
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array) Default false |
Description
Name hasPlugins()
Alias hasPlugin()
Alias isPlugins()
Alias isPlugin()
Check whether the given plugin(s) are activated for the given page.
Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:
<?php // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property. // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page. // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one. empty // load the current page false/true // same as above array(false,false) // same as above 2 // load page with ID 2 'rand' // load a random page of the current category array('rand',false) // same as above 'next' // load the next page in the current category array('next',false) // the same as above array('next','rand') // the same as above (it would discard the category ID) array(2,45) // load the page with ID 2 (it would discard the category ID) array(false,3) // load the first page of category with ID 3 array(false,'next') // load the first page of the next category array(false,'prev') // load the first page of the previous category array('last',false) // load the last page of the current category array('last','next') // load the last page of the next category array('first','last') // load the first page of the last category array('rand','next') // load a random page of the next category array('rand','rand') // load a random page of a random category array('first','rand') // load the first page of a random category ?>
Uses
- Feindura::$page
- Feindura::showPlugins() - to check for the activated plugins
- FeinduraBase::getPropertyIdsByString() - to load the right page and category IDs depending on the $ids parameter
- FeinduraBase::generatePage() - to generate the array with the page elements
- GeneralFunctions::getPageCategory() - to get the category of the page
Return Value
Version
line 2168
| array|string|false showPlugins ( |
[string|array|true $plugins = true], [int|string|array|bool $ids = false], [bool $returnPlugin = true]) |
Parameters
| string|array|true | $plugins |
(optional) the plugin name or an array with plugin names or TRUE to load all plugins Default true |
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array) Default false |
| bool | $returnPlugin |
(optional) whether the plugin is returned, or only a boolean to check if the plugin is available for that page (used by Feindura::hasPlugins()) Default true |
Description
Name showPlugins()
Alias showPlugin()
Returns the plugin(s) of a page ready for displaying in a HTML page. It can return an array where each element contain the HTML of a plugin (only the activated ones), or if the $plugins parameter is a string with a plugin name (the foldername of the plugin, inside "../feindura_folder/plugins/"), it returns only a string with the HTML of this plugin.
Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:
<?php // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property. // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page. // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one. empty // load the current page false/true // same as above array(false,false) // same as above 2 // load page with ID 2 'rand' // load a random page of the current category array('rand',false) // same as above 'next' // load the next page in the current category array('next',false) // the same as above array('next','rand') // the same as above (it would discard the category ID) array(2,45) // load the page with ID 2 (it would discard the category ID) array(false,3) // load the first page of category with ID 3 array(false,'next') // load the first page of the next category array(false,'prev') // load the first page of the previous category array('last',false) // load the last page of the current category array('last','next') // load the last page of the next category array('first','last') // load the first page of the last category array('rand','next') // load a random page of the next category array('rand','rand') // load a random page of a random category array('first','rand') // load the first page of a random category ?>
Example of the returned array:
<?php /* If you call this method and you give as $plugin parameter only a string with a pluginName, it returns only a string with this plugin content */ $plugins['onePlugin'] = '<p>HTML created by the Plugin</p> <span>What it is depends on the plugin :-)</span>'; $plugins['anotherPlugin'] = '<h1>Another plugin which follows the first one</h1> <p>You can alsocall specific plugins directly when you give the plugin name instead of "true", like in this example</p>'; ... return $plugins; ?>
Example usage:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example gets all plugins which are activated in the page with ID "2". You can also request only single plugins, it will then only return a string, with the HTML of the plugin. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // get the all plugins, which are activated in the page with ID "2" // displays the page (the "\n" creates a line break for a better look) foreach($plugins as $plugin) { echo $plugin; echo '------'; } /* *** RESULT with page *** -------------------------------------------------------------------------------- */ <p>HTML created by the Plugin</p> <span>What it is depends on the plugin :-)</span> ----- <h1>Another plugin which follows the first one</h1> <p>You can alsocall specific plugins directly when you give the plugin name instead of "true", like in this example</p> ----- ?>
Used By
- Feindura::hasPlugins() - to check for the activated plugins
Uses
- Feindura::$page
- FeinduraBase::getPropertyIdsByString() - to load the right page and category IDs depending on the $ids parameter
- FeinduraBase::generatePage() - to generate the array with the page elements
- GeneralFunctions::getPageCategory() - to get the category of the page
Return Value
Version
line 2298
| array listPages ( |
[string $idType = 'category'], [int|array|bool $ids = false], [int|array|bool $shortenText = false], [bool|string $useHtml = true], [bool $sortByCategories = false]) |
Parameters
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') Default false |
| bool|string | $useHtml |
(optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags. Default true |
| bool | $sortByCategories |
(optional) if TRUE it sorts the given category or page ID(s) by category Default false |
Description
Name listPages()
Alias listPage()
This method uses the $error..., $title... and $thumbnail... properties.
List pages by given category or page ID(s).
Returns an array with multiple pages for displaying in a HTML-page.
In case no page with the given category or page ID(s) exist it returns an empty array. Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.
Example of the returned array:
<?php array( 0 => array( 'id' => 1, 'category' => 'A Category', 'pageDate' => '2010-12-31', // format depending on the administrator-settings 'pageDateTimestamp' => 1325393999, 'title' => 'Title Example 1', 'thumbnail' => false, // page has no thumbnail 'thumbnailPath' => false, // page has no thumbnail 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag1 tag2 tag3', 'plugins' => array ( 'imageGallery' => array( 'galleryPath' => '', 'imageWidth' => 800, 'imageHeight' => null, 'thumbnailWidth' => 160, 'thumbnailHeight' => null, 'tag' => 'table', 'breakAfter' => 3 ) ) ), 1 => array( 'id' => 5, 'category' => 'A Category', 'pageDate' => '2009-12-31', 'pageDateTimestamp' => 1325393999, 'title' => 'Title Example 2', 'thumbnail' => false, // page has no thumbnail 'thumbnailPath' => false, // page has no thumbnail 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag3 tag4', 'plugins' => array () ), 2 => array( 'id' => 8, 'category' => 'Another Category', 'pageDate' => false, // page has no page date 'pageDateTimestamp' => false, 'title' => 'Title Example 3', 'thumbnail' => '<img src="/path/thumb_page3.png" alt="Thumbnail" title="Title Example 3" />', 'thumbnailPath' => '/path/thumb_page3.png', 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag3 tag1', 'plugins' => array () ) ) ... ?>
Example usage:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call listPages() without setting properties and list the current category given by $_GET variable. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // set properties // finally return the pages from the category with ID "1" and "2" using the above set properties // the page content will be shorten to "200" characters // displays the pages (the "\n" creates a line break for a better look) foreach($pages as $page) { echo $page['title']."\n\n"; echo $page['thumbnail']."\n"; echo $page['content']."<br />-----------------------<br />\n"; } /* *** RESULT with page *** -------------------------------------------------------------------------------- */ <a href="?category=1&page=2" title="2010-12-31 Example Page 2"> 2010-12-31 Example... </a> <h2>Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.</p> <a href="?category=1&page=2">mehr</a> <br />-----------------------<br /> <a href="?category=1&page=3" title="2010-12-31 Example Page 2"> 2010-12-31 Example... </a> <h2>Another Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum.</p> <h2>And one more Example Headline</h2> <p>Stet clita kasd gubergren, no sea takimata sanctus est...</p> <a href="?category=1&page=3">mehr</a> <br />-----------------------<br /> <a href="?category=2&page=1" title="Example Page 1"> Example Page 1 </a> <img src="/path/thumb_page3.png" alt="Thumbnail" title="Example Page 1" id="thumbId" class="thumbCLass" test="exampleAttribute1" onclick="exampleAttribute2" style="float:left;" /> <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, ur sadipscing elitr, Stet clita kasd...</p> <a href="?category=2&page=1">mehr</a> <br />-----------------------<br /> ?>
Used By
- Feindura::listPagesByTags() - to list the pages
- Feindura::listPagesByDate() - to list the pages
Uses
- Feindura::$xHtml
- Feindura::$showErrors
- Feindura::$errorTag
- Feindura::$errorId
- Feindura::$errorClass
- Feindura::$errorAttributes
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::getPropertyIdsByType() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- FeinduraBase::loadPagesByType() - to load the page $pageContent array(s) from the given ID(s)
- FeinduraBase::createAttributes() - to create the attributes used in the menu tag
- FeinduraBase::generatePage() - to generate every page which will be listed
- GeneralFunctions::sortPages() - to sort the $pageContent arrays by category
Return Value
Version
line 2400
| array listPagesByTags ( |
string|array $tags, [string $idType = 'category'], [int|array|bool $ids = false], [int|array|bool $shortenText = false], [bool|string $useHtml = true], [bool $sortByCategories = false]) |
Parameters
| string|array | $tags |
a string with tags seperated by "," or whitespaces, or an array with tags |
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') Default false |
| bool|string | $useHtml |
(optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags. Default true |
| bool | $sortByCategories |
(optional) if TRUE it sorts the given category or page ID(s) by category Default false |
Description
Name listPagesByTags()
Alias listPagesByTag(), listPageByTags(), listPageByTag()
This method uses the $error..., $title... and $thumbnail... properties.
List pages by given category or page ID(s), which have one or more of the tags from the given $tags parameter.
Notice: the tags will be compared case insensitive.
Returns an array with multiple pages for displaying in a HTML-page. In case no page with the given category or page ID(s) exist it returns an empty array.
Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.
Example usage:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example shows only the usage of tags for listing pages, for a detailed example see listPages() */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // the tags where the pages in the menu should have atleast one $tags = 'winter summer spring'; // could also be an array like // $tags = array(0 => 'winter', 1 => 'summer', 2 => 'spring'); // return the pages from the category with ID "1" // the page content will be shorten to "200" characters // displays the pages (the "\n" creates a line break for a better look) foreach($pages as $page) { echo $page['title'].'<br /> Has the following Tags: '.$page['tags']."\n"; echo $page['content']."<br />-----------------------<br />\n"; } /* *** RESULT with page *** -------------------------------------------------------------------------------- */ Example Page 1<br /> Has the following Tags: Winter antum <h2>Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.</p> <a href="?category=1&page=1">mehr</a> <br />-----------------------<br /> Example Page 2<br /> Has the following Tags: winter spring summer <h2>Another Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum.</p> <h2>And one more Example Headline</h2> <p>Stet clita kasd gubergren, no sea takimata sanctus est...</p> <a href="?category=1&page=2">mehr</a> <br />-----------------------<br /> Example Page 3<br /> Has the following Tags: spring antum <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, ur sadipscing elitr, Stet clita kasd...</p> <a href="?category=1&page=3">mehr</a> <br />-----------------------<br /> ?>
Uses
- Feindura::$xHtml
- Feindura::$showErrors
- Feindura::$errorTag
- Feindura::$errorId
- Feindura::$errorClass
- Feindura::$errorAttributes
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::getPropertyIdsByType() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- FeinduraBase::hasTags() - to get only the pages which have one or more tags from the given $tags parameter
- Feindura::listPages() - to list the pages
Return Value
Version
line 2498
| array listPagesByDate ( |
[string $idType = 'category'], [int|array|bool $ids = false], [int|bool|string $monthsInThePast = true], [int|bool|string $monthsInTheFuture = true], [int|array|bool $shortenText = false], [bool|string $useHtml = true], [bool $sortByCategories = false], [ $reverseList = false]) |
Parameters
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|bool|string | $monthsInThePast |
(optional) number of months before today, if TRUE it show all pages in the past, if FALSE it loads only pages starting from today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php Default true |
| int|bool|string | $monthsInTheFuture |
(optional) number of months after today, if TRUE it show all pages in the future, if FALSE it loads only pages until today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php Default true |
| int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') Default false |
| bool|string | $useHtml |
(optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags. Default true |
| bool | $sortByCategories |
(optional) if TRUE it sorts the given category or page ID(s) by category Default false |
| $reverseList |
Default false |
Description
Name listPagesByDate()
Alias listPagesByDates(), listPageByDate(), listPageByDates()
This method uses the $error..., $title... and $thumbnail... properties.
List pages by given category or page ID(s) sorted by the page date which have a page date and it fit in the time period from the $monthsInThePast and the $monthsInTheFuture parameter starting from the date today.
The $monthsInThePast and $monthsInTheFuture parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.
Returns an array with multiple pages for displaying in a HTML-page. In case no page with the given category or page ID(s) exist it returns an empty array.
Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.
Example usage:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example shows only the usage of tags for listing pages, for a detailed example see listPages() */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // the tags where the pages in the menu should have atleast one $tags = 'winter summer spring'; // could also be an array like // $tags = array(0 => 'winter', 1 => 'summer', 2 => 'spring'); // return the pages from the category with ID "1" // the page content will be shorten to "200" characters // displays the pages (the "\n" creates a line break for a better look) foreach($pages as $page) { echo $page['title'].'<br /> Has the following Tags: '.$page['tags']."\n"; echo $page['content']."<br />-----------------------<br />\n"; } /* *** RESULT with page *** -------------------------------------------------------------------------------- */ Example Page 1<br /> Has the following Tags: Winter antum <h2>Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.</p> <a href="?category=1&page=1">mehr</a> <br />-----------------------<br /> Example Page 2<br /> Has the following Tags: winter spring summer <h2>Another Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum.</p> <h2>And one more Example Headline</h2> <p>Stet clita kasd gubergren, no sea takimata sanctus est...</p> <a href="?category=1&page=2">mehr</a> <br />-----------------------<br /> Example Page 3<br /> Has the following Tags: spring antum <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, ur sadipscing elitr, Stet clita kasd...</p> <a href="?category=1&page=3">mehr</a> <br />-----------------------<br /> ?>
Uses
- Feindura::$xHtml
- Feindura::$showErrors
- Feindura::$errorTag
- Feindura::$errorId
- Feindura::$errorClass
- Feindura::$errorAttributes
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::loadPagesByDate() - to load the pages which fit in the given time period parameters, sorted by the page date
- Feindura::listPages() - to list the pages
Return Value
Version
line 2603
| array listPagesBySortFunction ( |
string $sortCallback, [string $idType = 'category'], [int|array|bool $ids = false], [int|array|bool $shortenText = false], [bool|string $useHtml = true], [bool $reverseList = false]) |
Parameters
| string | $sortCallback |
the name of the callback function to sort the pages (the callback function is a function which can be passed to usort()) |
| string | $idType |
(optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default 'category' |
| int|array|bool | $ids |
(optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property Default false |
| int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') Default false |
| bool|string | $useHtml |
(optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags. Default true |
| bool | $reverseList |
(optional) reverse the menu listing Default false |
Description
Name listPagesBySortFunction()
Alias listPagesBySort()
Alias listPagesBySortCallback()
Alias listPagesByCallback()
This method uses the $error..., $title... and $thumbnail... properties.
List pages from category or page ID(s) sorted by a custom sort function, passed in the first parameter $sortCallback. The custom sort function will be executed on the plain $pageContent array returned by the FeinduraBase::loadPagesByType() method.
Returns an array with multiple pages for displaying in a HTML-page.
In case no page with the given category or page ID(s) exist it returns an empty array. Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.
Example of the returned array:
<?php array( 0 => array( 'id' => 1, 'category' => 'A Category', 'pageDate' => '2010-12-31', // format depending on the administrator-settings 'pageDateTimestamp' => 1325393999, 'title' => 'Title Example 1', 'thumbnail' => false, // page has no thumbnail 'thumbnailPath' => false, // page has no thumbnail 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag1 tag2 tag3', 'plugins' => array ( 'imageGallery' => array( 'galleryPath' => '', 'imageWidth' => 800, 'imageHeight' => null, 'thumbnailWidth' => 160, 'thumbnailHeight' => null, 'tag' => 'table', 'breakAfter' => 3 ) ) ), 1 => array( 'id' => 5, 'category' => 'A Category', 'pageDate' => '2009-12-31', 'pageDateTimestamp' => 1325393999, 'title' => 'Title Example 2', 'thumbnail' => false, // page has no thumbnail 'thumbnailPath' => false, // page has no thumbnail 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag3 tag4', 'plugins' => array () ), 2 => array( 'id' => 8, 'category' => 'Another Category', 'pageDate' => false, // page has no page date 'pageDateTimestamp' => false, 'title' => 'Title Example 3', 'thumbnail' => '<img src="/path/thumb_page3.png" alt="Thumbnail" title="Title Example 3" />', 'thumbnailPath' => '/path/thumb_page3.png', 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag3 tag1', 'plugins' => array () ) ) ... ?>
Example usage:
<?php /* *** CODE *** -------------------------------------------------------------------------------- This example uses all possible properties. It's also works much more simple: just call listPages() without setting properties and list the current category given by $_GET variable. */ // a session will be started in the "feindura.include.php", // therefor you have to include this file before the header of the HTML page is sent, // which means before any HTML Tag. require('cms/feindura.include.php'); // creates a new Feindura instance // create the sort function, which we use with the listPagesBySortFunction() method function sortByLastEditDate($a,$b) { if ($a['lastSaveDate'] == $b['lastSaveDate']) return 0; return ($a['lastSaveDate'] > $b['lastSaveDate']) ? -1 : 1; } // now we return the pages from the category with ID "1" and "2" // the page content will be shorten to "200" characters // displays the pages (the "\n" creates a line break for a better look) foreach($pages as $page) { echo $page['title']."\n\n"; echo $page['thumbnail']."\n"; echo $page['content']."<br />-----------------------<br />\n"; } /* *** RESULT with page *** -------------------------------------------------------------------------------- */ <a href="?category=1&page=2" title="Example Page 2"> Example Page 2 </a> <h2>Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.</p> <a href="?category=1&page=2">mehr</a> <br />-----------------------<br /> <a href="?category=1&page=3" title="Example Page 3"> Example Page 3 </a> <h2>Another Example Headline</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing dolores et ea rebum.</p> <h2>And one more Example Headline</h2> <p>Stet clita kasd gubergren, no sea takimata sanctus est...</p> <a href="?category=1&page=3">mehr</a> <br />-----------------------<br /> <a href="?category=2&page=1" title="Example Page 1"> Example Page 1 </a> <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, ur sadipscing elitr, Stet clita kasd...</p> <a href="?category=2&page=1">mehr</a> <br />-----------------------<br /> ?>
Uses
- Feindura::$xHtml
- Feindura::$showErrors
- Feindura::$errorTag
- Feindura::$errorId
- Feindura::$errorClass
- Feindura::$errorAttributes
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::getPropertyIdsByType() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- FeinduraBase::loadPagesByType() - to load the page $pageContent array(s) from the given ID(s)
- FeinduraBase::createAttributes() - to create the attributes used in the menu tag
- FeinduraBase::generatePage() - to generate every page which will be listed
- GeneralFunctions::sortPages() - to sort the $pageContent arrays by category